rem 1 - alias
rem 2 - key pass (priv)
rem 3 - keystore (priv)
rem 4 - storepass (priv)
rem 5 - public key file (export)
rem 6 - keystore (import)
rem 7 - store pass (import)
rem ---------------------------------------------------------------------------
rem Creating private key
%java_home%\bin\keytool -genkey -alias %1 -keypass %2 -keystore %3 -storepass %4 -dname "CN=KIR OU=OU O=KIR L=Kazan C=RU" -keyalg RSA -keysize 1024 -validity 1000   -v
rem Self-sign certificate
%java_home%\bin\keytool -selfcert -alias %1 -keystore %3 -storepass %4 -keypass %2 -v
rem Export the public key
%java_home%\bin\keytool -export -alias %1 -file %5 -keystore %3 -storepass %4 -v
rem Import the public key to new keystore
%java_home%\bin\keytool -import -alias %1  -file %5 -keystore %6 -storepass %7 -v